package cate.game.role.res.guild.po;

import cate.game.GameBody;
import cate.game.role.Role;
import cate.game.role.RoleDependent;
import cate.game.role.res.guild.msg.GuildLogResp;
import cate.game.util.GameKit;
import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteField;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class GuildLogDetailPO {

    @NoteField(value = "唯一id")
    public String id;

    @NoteField(value = "日志时间")
    public long time;

    @NoteField(value = "系统文本id")
    public int tipsId;

    @NoteField(value = "日志内容参数")
    public List<Object> paramList;

    public GuildLogDetailPO() {
    }

    public GuildLogDetailPO(int tipsId, Object... args) {
        this.id = GameKit.uid();
        this.time = System.currentTimeMillis();
        this.tipsId = tipsId;
        paramList = new ArrayList<>();
        paramList.addAll(Arrays.asList(args));
    }

    /**
     * 通知前端新增的日志 *
     */
    @JsonIgnore
    public void noticeUpdate(Role role, int type) {
        role.sendNow(new GuildLogResp(this, type));
    }

}
